Public Class DayPhanSo
    Protected aPhanSo As New List(Of PhanSo)
    'property
    Property _aPhanSo() As List(Of PhanSo)
        Get
            Return Me.aPhanSo
        End Get
        Set(ByVal value As List(Of PhanSo))
            Me.aPhanSo = value
        End Set
    End Property
    'nhap
    Public Shared Function Nhap() As DayPhanSo
        Dim dps As New DayPhanSo
        Console.Write("Nhap n: ")
        Dim n As Integer = Integer.Parse(Console.ReadLine())
        For i As Integer = 0 To n - 1
            Dim ps As New PhanSo
            ps = PhanSo.Nhap()
            dps.aPhanSo.Add(ps)
        Next
        Return dps
    End Function
    'xuat
    Public Sub Xuat()
        For i As Integer = 0 To Me.aPhanSo.Count - 1
            Me.aPhanSo(i).Xuat()
            Console.Write(" ")
        Next
    End Sub
    'tong
    Public Function Tong() As PhanSo
        Dim s As PhanSo = aPhanSo(0)
        For i As Integer = 1 To Me.aPhanSo.Count - 1
            s = s.Tong(aPhanSo(i + 1))
            's = s + Me.aPhanSo(i).Tong(Me.aPhanSo(i + 1))
        Next
        Return s
    End Function
    

End Class
